#include<bits/stdc++.h>
#define INF 0x3f3f3f3f
using namespace std;
typedef long long LL;
typedef double db;
inline int read()
{
	int x=0,f=1;
	char ch=getchar();
	while(ch<'0'||ch>'9') { if(ch=='-')f=-1; ch=getchar(); }
	while(ch>='0'&&ch<='9') { x=(x<<1)+(x<<3)+ch-'0'; ch=getchar(); }
	return x*f;
}
const int MAXN=2510;
int n,m,head[MAXN],cnt,belog[51][51],tot,match[MAXN];
char a[51][51];
bool vis[MAXN];
struct edge
{
	int v,next;
}e[MAXN*MAXN*2];
void addedge(int x,int y)
{
	e[++cnt]=(edge){y,head[x]};
	head[x]=cnt;
	return;
}
bool Hungary(int u)
{
	for(int i=head[u];i;i=e[i].next)
	{
		int v=e[i].v;
		if(!vis[v])
		{
			vis[v]=true;
			if(!match[v]||Hungary(match[v]))
			{
				match[v]=u;
				return true;
			}
		}
	}
	return false;
}
int main()
{
#ifndef ONLINE_JUDGE
	freopen("in.in","r",stdin);
	freopen("out.out","w",stdout);
#endif
	n=read();m=read();
	for(int i=1;i<=n;++i)
	{
		++tot;
		scanf("%s",a[i]+1);
		for(int j=1;j<=m;++j)
			if(a[i][j]=='*')belog[i][j]=tot;
			else if(a[i][j]=='#'&&a[i][j-1]!='#'&&j!=1&&j!=m)++tot;
	}
	tot=0;
	for(int i=1;i<=m;++i)
	{
		++tot;
		for(int j=1;j<=n;++j)
		{
			if(a[j][i]=='*')addedge(tot,belog[j][i]);
			else if(a[j][i]=='#'&&a[j-1][i]!='#'&&j!=1&&j!=n)++tot;
		}
	}
	int ans=0;
	for(int i=1;i<=tot;++i)
	{
		memset(vis,0,sizeof(vis));
		if(Hungary(i))++ans;
	}
	printf("%d\n",ans);
}
